package app;

import java.io.File;
import java.util.*;

public class Test2 {
	public static void main(String[] args) {
		String path = "D:\\Faces\\JAFFE";
		File dfile = new File(path);
		List<String> list = new LinkedList<String>();
		if (dfile.isDirectory()) {
			File[] files = dfile.listFiles();
			for (int i = 0; i < files.length; i++) {
				String filename = files[i].getAbsolutePath();
				list.add(filename);
			}
		}

		int cnt = 1;
		for (String filename : list) {
			File file = new File(filename);
			if (file.exists()) {
				if (file.getName().startsWith("YM")) {
					file.renameTo(new File("D:\\Faces\\JAFFE\\s10\\" + cnt + ".bmp"));
					cnt++;
				}
			}
		}
	}
}
